package com.zimmur.tools;

import java.util.UUID;

import com.zimmur.service.RedisCacheUtil;

/**
 * 生成公钥
 * @author Administrator
 *
 */
public class PublicKey {

	public static synchronized String  getKey(RedisCacheUtil<String> redisCacheUtil,String publicKey){
		String strValue;
		if(redisCacheUtil.exists(publicKey)){
			strValue=redisCacheUtil.getCacheString(publicKey);
		}else{
			strValue=UUID.randomUUID().toString().replace("-", "").substring(0, 16);
			redisCacheUtil.setCacheString(publicKey, strValue);
			//不过期
			//redisCacheUtil.setTimeout(publicKey, 60*60*24);
		}
		return strValue;
	}
}
